import request from '@/utils/request.js'

// 常量
const api_name = '/order/h5/order'

export default {
    previewOrder(data) {
        return request({
            url: `${api_name}/previewOrder`,
            method: 'post',
            data: data
        })
    },
    createOrder(data) {
        return request({
            url: `${api_name}/createOrder`,
            method: 'post',
            data: data
        })
    },
    getOrderTotalCount() {
        return request({
            url: `${api_name}/getOrderTotalCount`,
            method: 'get'
        })
    },
    getOrderPageByStatus(params){
        return request({
            url: `${api_name}/getOrderPageByStatus`,
            method: 'get',
            params: params
        })
    },
    cancelOrderById(id){
        return request({
            url: `${api_name}/cancelOrderById/${id}`,
            method: 'post'
        })
    },
    deleteById(id){
        return request({
            url: `${api_name}/deleteById/${id}`,
            method: 'post'
        })
    },
    confirmOrderById(id){
        return request({
            url: `${api_name}/confirmOrderById/${id}`,
            method: 'post'
        })
    },
    getOrderDetailsById(id) {
        return request({
            url: `${api_name}/getOrderDetailsById/${id}`,
            method: 'get'
        })
    }
}
